angular
	.module('hello', ['ui.compat'])
	.config([
		'$stateProvider','$routeProvider','$urlRouterProvider',
		function ($stateProvider,$routeProvider,$urlRouterProvider){
			
			$routeProvider
				.when("", {
					redirectTo : "/home"
				})
				/*
				.when("/home", {
					template : '<h1>home</h1>'
				})
				*/
				;
			
			$stateProvider
				.state('home', {
					url: '/home',
					views: {
						'': {
							templateUrl: 'modules/home.html',
						},
						'hint@': {
							template: '<p>This is contacts.detail populating the view "hint@"</p>',
						},
					}
				})
				.state('admin', {
					url: '/admin',
					views: {
						'': {
							templateUrl: 'modules/admin.html',
						},
						'hint@': {
							template: '<a href="#/admin">#/admin/list</a><a href="#/admin/detail">#/admin/detail</a>',
						},
					},
					abstract: true,
					/*
					controller:['$scope', '$state', function($scope, $state){
						$scope.goToList = function(){
							$state.transitionTo('admin.list', {});
						};
						$scope.goToDetail = function(){
							$state.transitionTo('admin.detail', {});
						};
					}]
					*/
				})
				.state('admin.list', {
					url: '',
					templateUrl: 'modules/admin.list.html',
				})
				.state('admin.detail', {
					url: '/detail',
					templateUrl: 'modules/admin.detail.html',
				});
			
		}
	])
	.run([
		'$rootScope','$state','$stateParams',
		function ($rootScope,$state, $stateParams) {
			$rootScope.$state = $state;
			$rootScope.$stateParams = $stateParams;
		}
	]);
